<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="vue.global.js"></script>

    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id = 'app'>
<!--        <input type="text" v-model="message">-->
        <!--1：两种写法都可以-->
        <div v-bind:title="message" v-bind:class="myClass"
            @click="handleClick">{{message}}</div>

        <br>
        <div :title="message" :class="myClass"
            v-on:click="handleClick2($event ,1)">{{message}}</div>


    </div>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: 'Hello World!',
                myClass: 'box'
            }
        },
        methods:{
            //获取事件对象
            handleClick(event){
                this.message = 'hi vue';
                console.log(event)
            },
            handleClick2(event ,data){
                this.message = 'hi vue';
                console.log("event:"+event)
                console.log(data)
                this.message = data
            },
        },
        computed:{

        },
        watch:{

        },
        mounted(){

        }
    });
    let vm = app.mount('#app');

    // setTimeout(()=>{
    //     vm.message = 'hi vue'
    // },2000)
</script>
</body>
</html>